<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script type="text/javascript" src="vue.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>

<div  id="app">

    <div>
        <el-input v-model="searchinfo.orderpay" placeholder="订单金额" style="display: inline-block; width: 200px;">
        </el-input>
        <el-input type="date" v-model="searchinfo.orderdate" placeholder="订单日期" style="display: inline-block; width: 200px;">
        </el-input>
        <el-input  v-model="searchinfo.sname" placeholder="店铺名字" style="display: inline-block; width: 200px;">
        </el-input>
        <el-button icon="el-icon-search" circle @click="search()"></el-button>
    </div>

    <el-table :data="orderInfo" border style="width: 100%">
        <el-table-column prop="id" label="编号" width="180">
        </el-table-column>
        <el-table-column prop="userInfo.uname" label="用户">
        </el-table-column>
        <el-table-column prop="orderpay" label="订单金额">
        </el-table-column>
        <el-table-column prop="soid" label="订单编号">
        </el-table-column>
        <el-table-column prop="store.sname" label="店铺名">
        </el-table-column>
        <el-table-column prop="orderdate" label="订单日期">
        </el-table-column>
        <el-table-column
                fixed="right"
                label="操作"
                width="100">
            <template slot-scope="scope">
                <el-button type="text" size="small" @click="showDetails(scope.row.soid)">详情</el-button>
            </template>
        </el-table-column>
    </el-table>
    <el-pagination @current-change="handleCurrentChange" background layout="prev, pager, next" :total=pageTotal>
    </el-pagination>
</div>
<script>
    var app=new Vue({
        el: "#app",
        data: {
            orderInfo:[],
            searchinfo:{},
            pageTotal:0
        },
        methods: {
            showDetails:function(soid){
                window.location.href="/cai/showAdminOrder.html?soid="+soid;
            },
            handleCurrentChange: function(val) {
                getInfo(val, 10);
            },
            search:function () {
                getInfo(1,10);
            }
        }
    });
    function getInfo(a,b) {
        app.searchinfo.pageNo = a;
        app.searchinfo.pageCount = b;
        $.post("/cai/adminOrder/list", app.searchinfo,function (backData) {
            app.orderInfo = backData.data.currentPageData;
            app.pageTotal=backData.data.currentDataTotal;
        });
    }
    getInfo(1,10);
</script>
</body>
</html>